<?php

require_once("functions.php");
$db = connect_db();

$out = get_header();

$sql= "select * FROM languages ORDER BY language";

$res = mysql_query($sql, $db);

$out .= generate_menu();

$out .= "<h2>Language overview</h2>\n";

$out .= "<table>\n";
$out .= "<tr><th>Language</th><th>actions</th></tr>\n";

while (($row = mysql_fetch_array($res)) !== FALSE) {
	$id = $row["id"];
	$out .= "<tr><td>" . ucwords($row["language"]) . "</td><td><a href=\"edit_lang.php?action=edit&amp;id=$id\">edit</a></td></tr>\n";
}

$out .="</table>\n";

$out .= "<a href=\"edit_lang.php?action=new\">add language</a>";

$out .= get_footer();


echo $out;

?>
